<template>
    <div class="pagination-container">
      <div class="page-info">
        <span>第 {{ currentPage }} 页，共 {{ totalPages }} 页</span>
      </div>
      <div class="pagination-buttons">
        <button @click="gotoPage(1)" :disabled="currentPage === 1">首页</button>
        <button @click="prevPage" :disabled="currentPage === 1">上一页</button>
  
        <span>跳转到第<input v-model.number="inputPage" type="number" min="1" :max="totalPages" style="width:50px;">页</span>
  
        <button @click="nextPage" :disabled="currentPage === totalPages">下一页</button>
        <button @click="gotoPage(totalPages)" :disabled="currentPage === totalPages">尾页</button>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name:'BottomOfAssessment',
    props:['totalPages'],
    data() {
      return {
        currentPage: 1,
        inputPage: 1,
      };
    },
    methods: {
      gotoPage(page) {
        this.currentPage = page;
        this.$parent.gotoPage(this.currentPage);
      },
      prevPage() {
        if (this.currentPage > 1) {
          this.currentPage--;
          this.$parent.gotoPage(this.currentPage);
        }
      },
      nextPage() {
        if (this.currentPage < this.totalPages) {
          this.currentPage++;
          this.$parent.gotoPage(this.currentPage);
        }
      },
    },
  };
  </script>
  
  <style scoped>
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 10px; /* 添加内边距 */
  
  border-radius: 5px; /* 圆角边框 */
}

  
.pagination-buttons input {
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 50px;
  text-align: center;
}

.page-info {
  font-size: 14px;
  font-weight: 700;
  margin-right: 10px; /* 调整右边距 */
}
  
  .pagination-buttons button {
  margin-left: 10px;
  padding: 6px 12px;
  background-color: #e4a8e0; 
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease; /* 添加渐变效果 */
  height: 30px;
}
.pagination-buttons button:disabled {
  background-color: #ddd; /* 禁用状态的背景色 */
  cursor: not-allowed;
}
  </style>
  